package com.effectiv.gooruda.rest.service.api;

import java.io.InputStream;


import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;


import com.effectiv.gooruda.rest.docs.annotation.Api;
import com.effectiv.gooruda.rest.docs.annotation.ApiBodyObject;
import com.effectiv.gooruda.rest.docs.annotation.ApiHeader;
import com.effectiv.gooruda.rest.docs.annotation.ApiHeaders;
import com.effectiv.gooruda.rest.docs.annotation.ApiMethod;
import com.effectiv.gooruda.rest.docs.annotation.ApiParam;
import com.effectiv.gooruda.rest.docs.pojo.ApiVerb;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Path("/image")
@Api(name = "Image API", description = "Image processing API.")

public abstract class ImageService {
	
	@ApiMethod(path = "/api/image/convert/{name}/{format}", verb = ApiVerb.POST, description = "Convert an image file from one format to another.", 
			produces = { MediaType.APPLICATION_JSON }, consumes = { MediaType.APPLICATION_JSON})
	@ApiHeaders(headers = {
			@ApiHeader(name = "signature", description = "Authentication signature."),
			@ApiHeader(name = "public-key", description = "Public key of the application.") })
	
	@Path("/convert/{name}/{format}")
	@POST
	@Produces(MediaType.APPLICATION_JSON)
	public abstract Response convertFormat(
			@PathParam("name") 
			@ApiParam(name="name", description="Name of the image file") String name,
			
			
			@PathParam("format") 
			@ApiParam(name="format", description="Format to which to convert the file") 
			String format,
			
			@ApiBodyObject
			InputStream inputStream
			);
	
	public abstract Response crop(String name, InputStream inputStream, Integer width, Integer height, Integer x, Integer y);
	
	public abstract Response resize(String name, InputStream inputStream, Integer width, Integer height);
	
	public abstract Response resizeByPercentage(String name, InputStream inputStream, Double percentage);
	
	
	
	public abstract Response thumbnail(String name, InputStream inputStream, int width, int height) ;
	
	public abstract Response thumbnailByPercentage(String name, InputStream inputStream, Double percentage) ;
    
}
